package com.hanserwei.mydemo.closure;

public class ClosureDemo01 {
    static int a = 1;
    int b = 2;

    static void highOrder(Lambda lambda) {
        System.out.println(lambda.op(1));
    }

    public static void main(String[] args) {
        int x = 10;
        highOrder((int y) -> x + y);
    }

    public static void test() {
        highOrder((int y) -> a + y);
    }

    public void test2() {
        highOrder((int y) -> b + y);
    }

    public void test3(int c) {
        highOrder((int y) -> c + y);
    }

    @FunctionalInterface
    interface Lambda {
        int op(int y);
    }
}
